package main

import (
	"fmt"
)

//defer
func main() {
	res := sum(10, 20)
	fmt.Println("res=", res)
}
func sum(n1 int, n2 int) int {
	//当执行到defer时,暂时不执行,会将defer后面的语句亚茹到独立的defer栈中
	defer fmt.Println("n1=", n1)
	defer fmt.Println("n2=", n2)
	//增加一个语句
	n1++
	n2++
	res := n1 + n2
	fmt.Println("res=", res)
	return res
}
